<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网页版计数器</title>
</head>
<body>
<div id="change" class="change">
    <h1>{{ count }}</h1>
    <button>-</button>
    <button>+</button>
</div>

<script>
    let count = 0;

    let h1_element = document.querySelector("#change h1");
    h1_element.innerText = eval(h1_element.innerText)

    let minus_element = document.querySelector("#change > button:nth-child(2)");
    console.log(minus_element);

    let plus_element = document.querySelector("#change > button:nth-child(3)");
    console.log(plus_element);

    minus_element.addEventListener('click', function () {
        // console.log('点击了 -');
        h1_element.innerText = --count
    })

    plus_element.addEventListener('click', function () {
        h1_element.innerText = ++count
    })


</script>
</body>
</html>